<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Calendar" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="utf-8" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>测试首页</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="keywords" content=""/>
    <meta name="description" content=""/>
    <script type="text/javascript" src="frame/jquery-1.6.1.min.js"></script>

    <style type="text/css">

    </style>

    <script type="text/javascript">
        $(document).ready(function () {
            //setInterval这个函数会根据后面定义的2000既每隔2秒执行一次前面那个函数
            setInterval("changePageInfo()",2000);

        });

        function getUser() {
            var userid = document.getElementById("userId").value;
            window.open("/front/userController/getUser.do?id=" + userid, "_blank");
        }
        function getUsers() {
            window.open("/front/userController/getUsers.do", "_blank");
        }
        function takeFrame() {
            window.open("/front/frame/frame.do", "_blank");
        }
        function takeManage() {
            window.open("/front/frame/myManage.do", "_blank");
        }

        function changePageInfo() {
            $.ajax({
                url: '/front/frame/change.do',
                type: 'GET',

                error: function(data){
                    alert("失败！");
                },
                success: function(data){
                    var obj = eval(data);
                    document.getElementById("myPage").value = obj;
//                    alert("成功！");
                }
            });

        }

    </script>

</head>

<body>
<hr>
<p>

<form id="form1" name="form1" action="/front/userController/saveUser.do" method="post">
    新增用户：
    <input type="text" id="name" name="name" value=""/>
    分组
    <input type="text" id="groupid" name="groupid" value="1"/>
    <input type="submit" value="提交"/>
</form>
</p>
<hr>
<p>

<form id="form1" name="form1">
    查询的用户ID：
    <input type="text" id="userId" name="userId" value=""/>
    <input id="btnSubmit" name="btnSubmit" type="button" value="查询" onclick="getUser()"/>
    查询的所有用户：
    <input id="btnsSubmit" name="btnsSubmit" type="button" value="查询所有" onclick="getUsers()"/>
    本页面查询：
    <input type="text" id="myPage" name="myPage" value="myPage"/>
    <input id="myPageSub" name="myPageSub" type="button" value="查询" onclick="changePageInfo()"/>
</form>
</p>

<form id="form3" name="form3">
    进入主页：
    <input id="frameSubmit" name="frameSubmit" type="button" value="进入" onclick="takeFrame()"/>
    进入测试主页：
    <input id="frameSubmit" name="frameSubmit" type="button" value="进入" onclick="takeManage()"/>
    <tr>
        <td align="right">登录日期：</td>
        <td>
            <input name="loginDate" id="loginDate" style="MARGIN-LEFT: 0px;width=150px" readonly="readonly" type="text"> </input>
            <input name="putDate" id="putDate" style="MARGIN-LEFT: 0px;width=150px"  type="text"> </input>
            <label style="display: inline;position: absolute;"  id="lblImei" for="loginDate">
            <%= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime())  %>
        </label>
        </td>
    </tr>

    <img src="../images/logo.png" alt="smile" />

</form>
</p>
<%--页面主体内容 end--%>

<%--页脚开始--%>
<%--页脚结束--%>

<script type="text/javascript">

    var d = new Date();
    var month = d.getMonth() + 1;
    var day = d.getDate();
    if(month<10) month = "0"+month;
    if(day<10) day = "0"+day;
    var nowDate = d.getFullYear() + '-' + month + '-' + day;
    document.getElementById("loginDate").value = nowDate;

    document.getElementById("putDate").focus();

    Ext.BLANK_IMAGE_URL = "../images/loading.png";

    Ext.onReady(function(){
        Ext.QuickTips.init();
        var tranny = new Ext.form.ComboBox({
            typeAhead: true,
            triggerAction: 'all',
            transform:'sadminarea',
            width:200,
            height:20,
            forceSelection:true
        });
    });

</script>
</body>
</html>
